-
Notifications
You must be signed in to change notification settings - Fork 4
Improve paganin filter method's memory estimation #454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The fact that the 2D FFT used in `paganin_filter_tomopy()` is C2C, in conjunction with the use of `overwrite_x=True`, means that the result is able to be written into the input array. Thus, no new array is created to hold the result of the 2D FFT.
Also move variable in final sum to match the order in which the allocations appear in the method.
The padded `float32` array is cast to `complex64`, and the variable originally assigned to the `float32` version is reassigned to the `complex64` version. The reassigned variable was the only thing referring to the `float32` array, so the ref count of it drops to 0 and is deallocated. The padded `float32` array gets deallocated early enough in the method that it doesn't contribute to the *peak* memory usage of the paganin filter method, which was verified by checking: - the output of `LineProfileHook` when running the method - the allocations and deallocations reported by the custom `MaxMemoryHook` in the tests during the method's execution
The method's code defines the reciprocal grid based on the padded projections `complex64` array shape. However, the memory estimator was incorrectly calculating the number of bytes the reciprocal grid takes using the unpadded `float32` array shape.
paganin_filter_tomopy
memory estimation
Ok, both paganin filter method's memory hook tests now pass on:
so I'm hopeful that at least the bulk of the significant memory allocations in both methods are accounted for correctly in their respective estimators. Before I mark this as ready to review I will write up an issue on the changes in b32a2c8, because they will surely raise some questions and thus require a bit of an explanation... |
yousefmoazzam
added a commit
to DiamondLightSource/httomo-backends
that referenced
this pull request
Dec 11, 2024
Reflects changes to paganin filter memory estimators in DiamondLightSource/httomo#454.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #430
Checklist